<template>
	<view class="withdrawal">
		<view class="top">
			<view class="left">
				可提现金额：￥{{Number(balance)}}
			</view>
			<view class="right" @click="allBalance">
				全部提现
			</view>
		</view>
		<view class="inputbox">
			<view class="title">
				提现金额 提现额度最小为：<text class="red">￥{{Number(withdraw_down)}}</text>
			</view>
			<view class="inputlist">
				<text>￥</text>
				<input type="number" v-model="num">
			</view>
		</view>
		<view class="bankinfo">
			<view class="title">
				提现方式
			</view>
			<!-- <view class="choosebank">
				<view class="left">
					<uni-icons type="chatboxes" size="24" color="#FFD52C"></uni-icons>
					<text>提现到银行卡</text>
				</view>
				<label class="radio">
					<radio value="1" checked="true" />
				</label>
			</view> -->
			<view class="choosebank">
				<view class="left">
					<uni-icons type="chatboxes" size="24" color="#FFD52C"></uni-icons>
					<text>提币到钱包</text>
				</view>
				<label class="radio">
					<radio value="1" checked="true" />
				</label>
			</view>
			<view class="inputlist">
				<text class="input_left">钱包地址</text>
				<input type="text" v-model="wallet_address" placeholder="请输入钱包地址">
			</view>
			<!-- <view class="inputlist">
				<text class="input_left">银行账户</text>
				<input type="text" v-model="bank_user" placeholder="请输入银行账户">
			</view>
			<view class="inputlist">
				<text class="input_left">银行名称</text>
				<input type="text" v-model="bank_name" placeholder="请输入银行名称">
			</view>
			<view class="inputlist">
				<text class="input_left">银行账号</text>
				<input type="text" v-model="bank_num" placeholder="请输入银行卡号">
			</view>
			<view class="inputlist">
				<text class="input_left">支行</text>
				<input type="text" v-model="bank_open" placeholder="请输入支行">
			</view> -->
			<view class="inputlist">
				<text class="input_left">支付密码</text>
				<input type="text" v-model="password" placeholder="请确认支付密码">
			</view>
			<view class="tips">
				提现手续费为{{Number(withdraw_fees)}}%
			</view>
		</view>
		<view class="btn">
			<button class="btn_sumbit" @click="Withdraw">提交</button>
		</view>
	</view>
</template>

<script>
	import {
		UserIndex
	} from "@/api/api.js"
	import {
		Withdraw
	} from "@/api/user.js"
	export default {
		data() {
			return {
				num: '',
				bank_user: '',
				bank_num: '',
				bank_name: '',
				password: '',
				bank_open: '',
				balance: 0,
				withdraw_fees: 0,
				withdraw_down: 0,
				wallet_address: ''
			}
		},
		onLoad() {
			this.UserIndex()
		},
		methods: {
			allBalance() {
				this.num = this.balance
			},
			UserIndex() {
				UserIndex().then(res => {
					console.log(res);
					this.withdraw_down = res.data.withdraw_down
					this.withdraw_fees = res.data.withdraw_fees
					this.balance = res.data.info.balance_3
				})
			},
			Withdraw() {
				Withdraw({
					num: this.num,
					wallet_address: this.wallet_address,
					bank_name: this.bank_name,
					bank_user: this.bank_user,
					bank_num: this.bank_num,
					bank_open: this.bank_open,
					password: this.password
				}).then(res => {
					uni.showToast({
						title: res.message,
						icon: "none"
					})
					if (res.status == 1) {
						uni.navigateBack({

						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #0F172A;
	}

	.withdrawal {}

	.btn {
		margin: 15px 0;

		.btn_sumbit {
			background: #798AD6;
			color: #fff;
			width: 80%;
			font-size: 14px;
			box-sizing: border-box;
		}
	}

	.bankinfo {
		background: #1E293B;
		width: 96%;
		margin: 0 auto;
		margin-top: 10px;
		font-size: 14px;
		padding: 0 15px;
		box-sizing: border-box;
		border-radius: 8px;
		margin-bottom: 15px;

		.title {
			color: #fff;
			padding: 10px 0;
		}

		.choosebank {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 10px 0;

			.left {
				display: flex;
				align-items: center;
				color: #fff;

				text {
					margin-right: 5px;
				}
			}
		}

		.tips {
			padding: 15px 0;
			color: #fff;
		}

		.inputlist {
			display: flex;
			align-items: center;
			font-size: 14px;
			padding: 15px 0;
			color: #fff;

			.input_left {
				width: 25%;
			}

			input {
				font-size: 14px;
				color: #fff;
			}
		}
	}

	.top {
		display: flex;
		justify-content: space-between;
		padding: 10px;
		font-size: 14px;

		.left {
			color: #fff;
		}

		.right {
			color: #7989D5;
		}
	}

	.inputbox {
		background: #1E293B;
		width: 96%;
		margin: 0 auto;
		padding: 15px 10px;
		font-size: 14px;
		box-sizing: border-box;
		border-radius: 8px;

		.title {
			color: #fff;

			.red {
				color: #fff;
			}
		}

		.inputlist {
			display: flex;
			align-items: center;
			font-size: 20px;
			padding: 10px 0;
			color: #fff;

			input {
				color: #fff;
				padding-left: 10px;
				font-size: 20px;
			}
		}
	}
</style>